

const requestMode = require('../../../js/requestsMode.js');
const session = require('../../../js/session.js');
const  Tools = require('../../../js/Tools.js');
Page({
  data: {
    title:'',
    content:''
  },
  onLoad: function (options) {
  
  },
  titleChange:function(e){
    this.setData({
      title: e.detail.value
    })
  },
  contentChange:function(e){
    this.setData({
      content: e.detail.value
    })
  },
  submitMessage:function(){
    let title = this.data.title;
    let content = this.data.content;
    if(!title){
      Tools.showErrorToast('请输入标题');
      return;
    }
    if(!content){
      Tools.showErrorToast('请输入内容');
      return;
    }
    requestMode.sendRequest('member/feedback','POST',{title:title,content:content},{sKey:session.get('sKey')}).then(function(res){
      let code = res.data.code;
      if(code == 200){
        Tools.showSuccessInfoToast('反馈成功！');
      }else{
        Tools.showSuccessInfoToast(res.data.message);
      }
    },function(res){
      Tools.showSuccessInfoToast(res.data.message);
    })
  }
});